﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebApplication1.DDD.Web.Default.users
{
    public class deleteAction  : Controller
	{
		#if (!AspNET && !MicrosoftOwin && !NFinalOwin)
		public deleteAction(HttpContext context):base(context){}
		public deleteAction(Microsoft.Owin.IOwinContext context):base(context){}
		public deleteAction(NFinal.Owin.HtmlWriter writer,NFinal.Owin.Request request):base(writer,request){}
		#endif
		#if AspNET
		public deleteAction(HttpContext context):base(context){}
		#endif
		#if MicrosoftOwin
		public deleteAction(Microsoft.Owin.IOwinContext context):base(context){}
		#endif
		#if NFinalOwin
		public deleteAction(string fileName, NFinal.Owin.Request request, NFinal.CompressMode compressMode) :base(fileName,request,compressMode){}
		public deleteAction(System.IO.Stream stream,NFinal.Owin.Request request, NFinal.CompressMode compressMode) : base(stream,request,compressMode) {}
		public deleteAction(System.Collections.Generic.IDictionary<string, object> enviroment, NFinal.Owin.Request request, NFinal.CompressMode compressMode):base(enviroment,request,compressMode){}
		#endif
		public deleteAction(Controller controller):base(controller){}
        
        
        

        public void delete(int id)
        {
            
var con = new System.Data.SQLite.SQLiteConnection(NFinal.Config.ConfigurationManager.ConnectionStrings["Common"].ConnectionString);
con.Open();

            
#region	var count; 删除记录,返回受影响行数
			var __delete_count_command__ = new System.Data.SQLite.SQLiteCommand("delete from users where id=@id", con);
						var __delete_count_parameters__=new System.Data.SQLite.SQLiteParameter[1];
			
			__delete_count_parameters__[0] = new System.Data.SQLite.SQLiteParameter("@id",System.Data.DbType.Int64);
			__delete_count_parameters__[0].Value = id.WithDBNull();
						__delete_count_command__.Parameters.AddRange(__delete_count_parameters__);
						var count = __delete_count_command__.ExecuteNonQuery();
			__delete_count_command__.Dispose();
			#endregion
			
            con.Close();
            AjaxReturn(count > 0);
        }
    }
}